package cn.fx.controller;

import cn.fx.domain.Store;
import cn.fx.service.IStoreService;
import cn.fx.util.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (Store)表控制层
 *
 * @author makejava
 * @since 2022-08-24 13:33:43
 */
@RestController
@RequestMapping("/store")
@Api(value = "价格API",description="商品数量相关的CRUD功能")
public class StoreController {
    /**
     * 注入对象
     */
    @Autowired
    private IStoreService storeService;

    @PostMapping
    @ApiOperation(value = "添加商品信息")
    public JsonResult save(@RequestBody Store store){
        try {
            storeService.save(store);
            return JsonResult.me();

        } catch(Exception e) {
            e.printStackTrace();
            return JsonResult.me().setMsg("网络异常，稍后重试");
        }
    }
}

